package com.acme.bankapp;

import com.acme.bankapp.domain.bank.*;
import com.acme.bankapp.service.bank.BankService;

public class BankApplicastion {
    public static void main(String[] args) {
        Bank bank = new Bank();
        BankService bankService = new BankService();
        Client henry = new Client("Henry", Gender.MALE);
        henry.addAccount(new CheckingAccount(100., 3150.));
        Client scroodge = new Client("Scroodge McDuck", Gender.MALE);
        scroodge.addAccount(new SavingAccount(1000000000000.));
        bankService.addClient(bank, henry);
        bankService.addClient(bank, scroodge);
        printBalance(bank);
        modifyBank(bank);
        printBalance(bank);
    }

    public static void modifyBank(final Bank bank) {
        for (Client client : bank.getClients()) {
            Account account = client.getAccounts().get(0);
            account.deposit(30.);
            account.withdraw(500.);
        }
    }

    public static void printBalance(final Bank bank) {
        for (Client client : bank.getClients()) {
            for (Account account : client.getAccounts()) {
                client.getClientSalutation();
                System.out.println(": " + account.getBalance());
            }
        }
        System.out.println();
    }
}
